module.exports = function(sequelize, DataTypes) {
  var DocumentTag = sequelize.define(
    'DocumentTag',
    {},
    {
      tableName: 'document_tag',
      paranoid: true,
      indexes: [
        {
          name: 'user_id_idx',
          fields: ['userId']
        }
      ],
      comments: '文件-标签连接表'
    }
  )

  DocumentTag.associate = function(models) {
    this.belongsTo(models.User, {
      as: 'Owner',
      foreignKey: 'userId',
      constraints: false
    })
  }
  return DocumentTag
}
